package ij.umasuo.gui.camera;

import java.awt.Insets;
import java.awt.Label;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * the camera control
 * @author storm
 *
 */
public class CameraCtrUI extends JPanel{
	

	private static final long serialVersionUID = 1L;
	
	private static CameraCtrUI instance = null;
	private JTextField exposureTF;
	private JButton snapBTN = new JButton("Snap");
	private JButton albumBTN = new JButton("Album");
	private JButton multiBTN = new JButton("Multi-D Acq.");
	private JButton refreshBTN = new JButton("Refresh");
	private JButton liveBTN = new JButton("Live");
	private CameraCtrUI(){
		setLayout(null);
		snapBTN.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				
			}
		});
		
		snapBTN.setBounds(10, 10, 100, 25);
		snapBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/camera.png")) );
		add(snapBTN);
		
		liveBTN.setBounds(10, 40, 100, 25);
		liveBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/camera_go.png")) );
		add(liveBTN);
		
		albumBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/camera_plus_arrow.png")) );
		albumBTN.setMargin(new Insets(2,2,2,2));
		albumBTN.setBounds(10, 70, 100, 25);
		add(albumBTN);
		
		multiBTN.setBounds(10, 100, 100, 25);
		multiBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/film_go.png")) );
		multiBTN.setMargin(new Insets(2,2,2,2));
		add(multiBTN);
		
		refreshBTN.setBounds(10, 130, 100, 25);
		refreshBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/arrow_refresh.png")) );
		add(refreshBTN);
		

		Label label = new Label("Exposure [ms] : ");
		label.setBounds(128, 11, 89, 22);
		add(label);
		
		exposureTF = new JTextField();
		exposureTF.setBounds(218, 12, 86, 20);
		add(exposureTF);
		exposureTF.setColumns(10);
		
		JLabel biningBTN = new JLabel("Binning : ");
		biningBTN.setBounds(132, 45, 46, 14);
		add(biningBTN);
		
		JComboBox biningCB = new JComboBox();
		biningCB.setBounds(218, 42, 86, 20);
		add(biningCB);
		
		JLabel lblNewLabel = new JLabel("Shutter : ");
		lblNewLabel.setBounds(128, 75, 46, 14);
		add(lblNewLabel);
		
		JComboBox shutterCB = new JComboBox();
		shutterCB.setBounds(218, 72, 86, 20);
		add(shutterCB);
		
		JCheckBox chckbxAutoShutter = new JCheckBox("Auto Shutter");
		chckbxAutoShutter.setSelected(true);
		chckbxAutoShutter.setBounds(128, 101, 97, 23);
		add(chckbxAutoShutter);
		
		JButton roiInBTN = new JButton("");
		roiInBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/shape_handles.png")) );
		roiInBTN.setBounds(10, 166, 25, 25);
		add(roiInBTN);
		
		JButton roiOutBTN = new JButton("");
		roiOutBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/arrow_out.png")) );
		roiOutBTN.setBounds(45, 166, 25, 25);
		add(roiOutBTN);
		
		JButton zoomInBTN = new JButton("");
		zoomInBTN.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/zoom_in.png")) );
		zoomInBTN.setBounds(80, 166, 25, 25);
		add(zoomInBTN);
		
		JButton zoomOutBtn = new JButton("");
		zoomOutBtn.setIcon(new ImageIcon(CameraCtrUI.class.getResource("/res/zoom_out.png")) );
		zoomOutBtn.setBounds(115, 166, 25, 25);
		add(zoomOutBtn);
	}
	
	public static CameraCtrUI getInstance(){
		if(instance == null){
			instance = new CameraCtrUI();
		}
		return instance;
	}
	
	
}
